package lottery;

import java.awt.Color;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.GroupLayout;  
import javax.swing.GroupLayout.Alignment;  
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;  
import javax.swing.JPasswordField;  
import javax.swing.JRadioButton;  
import javax.swing.JTextField;
import javax.swing.WindowConstants;

import dao.User;  
public class Show extends JFrame {  
    
    JLabel label1;  
    JLabel label2;  
    JLabel label3;  
    JLabel label4;
    JLabel label5;
    JLabel label6;
    JLabel m1;  
    JLabel m2; 
    JLabel m3; 
    JLabel m4; 
    
  User user3=new User();
    JButton bt1;  
    JButton bt2;  
  
    public Show(User user) {  
    	
    	user3=user;
        this.setVisible(true);  
       // this.setSize(500, 250);  
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setBackground(Color.CYAN);
        int width = Toolkit.getDefaultToolkit().getScreenSize().width;
		int height = Toolkit.getDefaultToolkit().getScreenSize().height;
        this.setVisible(true);  
        super.setLocation((width - 400) / 2, (height - 350) / 2);  
        getContentPane().setBackground(Color.CYAN);
        
        label1 = new JLabel("用户信息");  
        label1.setFont(new Font("宋体", 1, 20)); // NOI18N
        label1.setText("个人信息");
        label2 = new JLabel("ID:" +"          "+ user.getId());  
        label3 = new JLabel("用户名:" +"          "+ user.getUsername()); 
        label4 = new JLabel("电话号码:" +"          "+ user.getTelNum());
        label5 = new JLabel("余额:" +"          " +user.getMoney());
        
        String str1=user.getNum();
        if(str1.equals("NULL")){
        	
        	label6 = new JLabel("彩票的号码：" +"null");
        }
        else
        {
        	String hu[]=str1.split(" ");
            String str2=hu[0]+" "+hu[1]+" "+hu[2]+" "+hu[3]+" "+hu[4]+" "+hu[5]+" "+hu[6];
            
              
              
              label6 = new JLabel("彩票的号码：" +"          [" +str2+"]*"+hu[7]);
        }
        m1 = new JLabel();  
        m2 = new JLabel(); 
        m3= new JLabel(); 
        m4= new JLabel();  
       //String t1=;
        
        bt1 = new JButton("返回");  
        
        bt1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	setVisible(false); 
                
            }
        });
        // 为指定的 Container 创建 GroupLayout  
        GroupLayout layout = new GroupLayout(this.getContentPane());  
        this.getContentPane().setLayout(layout);  
        //创建GroupLayout的水平连续组，，越先加入的ParallelGroup，优先级级别越高。  
        
        GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();  
       hGroup.addGap(60);//添加间隔  
        hGroup.addGroup(layout.createParallelGroup().addComponent(label2)  
                .addComponent(label3).addComponent(label4).addComponent(label5).addComponent(label6));  
        hGroup.addGap(5);  
        hGroup.addGroup(layout.createParallelGroup().addComponent(label1)  
                .addComponent(m1).addComponent(m2).addComponent(m3)  
                .addComponent(m4).addComponent(bt1));  
        hGroup.addGap(60);  
        layout.setHorizontalGroup(hGroup);  
        //创建GroupLayout的垂直连续组，，越先加入的ParallelGroup，优先级级别越高。  
        GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();  
        vGroup.addGap(20);  
        vGroup.addGroup(layout.createParallelGroup().addComponent(label1));  
        vGroup.addGap(10);  
        vGroup.addGroup(layout.createParallelGroup().addComponent(label2)  
                .addComponent(m1));  
        vGroup.addGap(10);  
        vGroup.addGroup(layout.createParallelGroup().addComponent(label3)  
                .addComponent(m2));  
        vGroup.addGap(10); 
        vGroup.addGroup(layout.createParallelGroup().addComponent(label4).addComponent(m3));  
        vGroup.addGap(10); 
        vGroup.addGroup(layout.createParallelGroup().addComponent(label5).addComponent(m4));
        vGroup.addGap(10);
        vGroup.addGroup(layout.createParallelGroup().addComponent(label6).addComponent(m4));
        vGroup.addGap(10);
        vGroup.addGroup(layout.createParallelGroup()  
                .addComponent(bt1));  
        vGroup.addGap(20);  
        //设置垂直组  
        layout.setVerticalGroup(vGroup);  
        pack();
        
    }  
}  